#ifndef ITERATORLIST_H_INCLUDED
#define ITERATORLIST_H_INCLUDED

namespace CEngine {

template<class E, class K>
Iterator<E,K>::Iterator(const typename LinkedList<E>::ListIterator& it)
    :   type(LinkedList)
{
    iteratorData.list.basePointer = it.basePointer;
    iteratorData.list.currentElement = it.currentPointer;
    iteratorData.list.position = it.position;
}

template<class E, class K>
Iterator<E,K>&
Iterator<E,K>::operator=(const typename LinkedList<E>::ListIterator& it) {
    type = LinkedList;
    iteratorData.list.basePointer = it.basePointer;
    iteratorData.list.currentElement = it.currentPointer;
    iteratorData.list.position = it.position;
    return *this;
}

template<class E, class K>
bool Iterator<E,K>::operator==(const typename LinkedList<E>::ListIterator& it) const {
    ASSERT(type == LinkedList);

    if(iteratorData.list.currentElement == it.currentPointer) {
        return true;
    }
    return false;
}

template<class E, class K>
bool Iterator<E,K>::operator!=(const typename LinkedList<E>::ListIterator& it) const {
    ASSERT(type == LinkedList);

    if(iteratorData.list.currentElement != it.currentPointer) {
        return true;
    }
    return false;
}

template<class E, class K>
bool Iterator<E,K>::operator>(const typename LinkedList<E>::ListIterator& it) const {
    ASSERT(type == LinkedList && iteratorData.list.basePointer == it.basePointer);

    if(iteratorData.list.position > it.position) {
        return true;
    }
    return false;
}

template<class E, class K>
bool Iterator<E,K>::operator<(const typename LinkedList<E>::ListIterator& it) const {
    ASSERT(type == LinkedList && iteratorData.list.basePointer == it.basePointer);

    if(iteratorData.list.position < it.position) {
        return true;
    }
    return false;
}

template<class E, class K>
bool Iterator<E,K>::operator>=(const typename LinkedList<E>::ListIterator& it) const {
    ASSERT(type == LinkedList && iteratorData.list.basePointer == it.basePointer);

    if(iteratorData.list.position >= it.position) {
        return true;
    }
    return false;
}

template<class E, class K>
bool Iterator<E,K>::operator<=(const typename LinkedList<E>::ListIterator& it) const {
    ASSERT(type == LinkedList && iteratorData.list.basePointer == it.basePointer);

    if(iteratorData.list.position <= it.position) {
        return true;
    }
    return false;
}

}

#endif // ITERATORLIST_H_INCLUDED
